package com.ddone.transaction.xml.dao.impl;

import com.ddone.transaction.xml.dao.EmpDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * @author ddone
 * @date 2024/3/21-02:09
 */
@Slf4j
public class EmpDaoImpl implements EmpDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void addMoney(Integer inId, int money) {
        log.warn("===========加钱方法执行===========");
        String sql = "update t_emp set emp_salary=emp_salary+? where emp_id=?";
        jdbcTemplate.update(sql,money,inId);
    }

    @Override
    public void subMoney(Integer outId, int money) {
        String sql = "update t_emp set emp_salary=emp_salary-? where emp_id=?";
        jdbcTemplate.update(sql,money,outId);
        log.warn("===========减钱方法执行===========");
    }
}
